#ifndef	_SOCKET_H_
#define	_SOCKET_H_

#include <stdint.h>
#include"regs.h"
#define SOCK_TCPS             0
#define SOCK_HUMTEM			  0
#define SOCK_PING			  0
#define SOCK_TCPC             1
#define SOCK_UDPS             2
#define SOCK_WEIBO      	  2
#define SOCK_DHCP             3
#define SOCK_HTTPS            4
#define SOCK_DNS              5
#define SOCK_SMTP             6
#define SOCK_NTP              7
//#define NETBIOS_SOCK    6 //在netbios.c已定义



 uint8_t socket_w5500(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag,int fd); // Opens a socket(TCP or UDP or IP_RAW mode)
 void close_w5500(SOCKET s,int fd); // Close socket
 uint8_t connect_w5500(SOCKET s, uint8_t * addr, uint16_t port,int fd); // Establish TCP connection (Active connection)
 void disconnect_w5500(SOCKET s,int fd); // disconnect the connection
 uint8_t listen_w5500(SOCKET s,int fd);	// Establish TCP connection (Passive connection)
 uint16_t send_w5500(SOCKET s, const uint8_t * buf, uint16_t len,int fd); // Send data (TCP)
 uint16_t recv_w5500(SOCKET s, uint8_t * buf, uint16_t len,int fd);	// Receive data (TCP)
 uint16_t sendto_w5500(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port,int fd); // Send data (UDP/IP RAW)
 uint16_t recvfrom_w5500(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t  *port,int fd); // Receive data (UDP/IP RAW)



#endif